# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorEvent do
  @moduledoc """
  An error event which is returned by the Error Reporting system.

  ## Attributes

  *   `context` (*type:* `GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorContext.t`, *default:* `nil`) - Data about the context in which the error occurred.
  *   `eventTime` (*type:* `DateTime.t`, *default:* `nil`) - Time when the event occurred as provided in the error report. If the report did not contain a timestamp, the time the error was received by the Error Reporting system is used.
  *   `message` (*type:* `String.t`, *default:* `nil`) - The stack trace that was reported or logged by the service.
  *   `serviceContext` (*type:* `GoogleApi.CloudErrorReporting.V1beta1.Model.ServiceContext.t`, *default:* `nil`) - The `ServiceContext` for which this error was reported.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :context => GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorContext.t() | nil,
          :eventTime => DateTime.t() | nil,
          :message => String.t() | nil,
          :serviceContext => GoogleApi.CloudErrorReporting.V1beta1.Model.ServiceContext.t() | nil
        }

  field(:context, as: GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorContext)
  field(:eventTime, as: DateTime)
  field(:message)
  field(:serviceContext, as: GoogleApi.CloudErrorReporting.V1beta1.Model.ServiceContext)
end

defimpl Poison.Decoder, for: GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorEvent do
  def decode(value, options) do
    GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorEvent.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.CloudErrorReporting.V1beta1.Model.ErrorEvent do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
